package net.jalisq.functions;

import java.util.Arrays;
import java.util.List;

import net.jalisq.types.Aliasable;
import net.jalisq.types.DerivedColumnAdapterAliasable;
import net.jalisq.types.IDerivedColumn;

import wulfUtils.functional.Lists;


public class Concat extends DerivedColumnAdapterAliasable implements IDerivedColumn{
	public Concat(final Aliasable ... cols) {
		super("", String.class, cols);
		final StringBuilder sb = new StringBuilder();
		Lists.iter(Arrays.asList(cols), 
			new Lists.Iteration<Aliasable>(){
				
				@Override
				public boolean each(int x, Aliasable entry) {
					sb.append(entry.getRepr());
					if( x + 1 < cols.length) {
						sb.append(",");
					}
					return true;
				}
				
			}
		
		);
		repr = sb.toString();
		
		
		
		
	}
	
}
